def getMainPage():
	return """<html>
            <body>
              <center>
              <h1> Welcome to the CS 739 Checksum Cracker </h1>
              <h3> Here we help you forge documents to pass puny checksum validation, so as to defy authority, deny security and in general, do bad things.</h3>
              <p> Enter the text of the first document in the box below or upload a file. </p>
			  <form action="/InputText1" method="post">
                Document 1: 
                <div><textarea name="doc1" rows="5" cols="80"></textarea></div>               
				Document 2: 
                <div><textarea name="doc2" rows="5" cols="80"></textarea></div>               
                <div><input type="submit" value="Upload Text"></div>
              </form>
             </center>
            </body>
          </html>"""
		  
def getPreFinalOutput(requestID, numThreads):
	return """<html>
				<head>
					<META HTTP-EQUIV="refresh" CONTENT="5; url=/finaloutput?requestID=""" + str(requestID) + """ ">
				</head>
				<body>
					<center>
						<h1>Welcome, wannabe hacker and doer of bad things.</h1>
						<h3>Your request ID is: </h3>
						<p>""" + str(requestID) + """</p>
						<h3>There should be a total of """ + str(numThreads) + """ results when complete.</h3>
				</body>
			</html>"""
		  
def getFinalOutput(requestID, numThreads, resultTuples):
	currentData = ""
	for tuple in resultTuples:
		currentData += "<tr><td>" + str(tuple.bit_diff) + \
						"</td><td>" + str(tuple.closest_checksum) + \
						"</td><td>" + str(tuple.best_match_string) + \
						"</td><td>" + str(tuple.finish_time) + "</td></tr>"
	return """<html>
				<head>
					<META HTTP-EQUIV="refresh" CONTENT="5; url=/finaloutput?requestID=""" + str(requestID) + """ ">
				</head>
				<body>
					<center>
						<h1>Welcome, wannabe hacker and doer of bad things.</h1>
						<h3>Your request ID is: </h3>
						<p>""" + str(requestID) + """</p>
						<h3>There should be a total of """ + str(numThreads) + """ results when complete.</h3>
						<table border="1" cellpadding="1" cellspacing="1">
						<tr>
							<td><b>Bit Difference</b></td>
							<td><b>Closest Checksum</b></td>
							<td><b>Best Match String</b></td>
							<td><b>Time</td></b>
						</tr>""" + currentData + """</table>
				</body>
			</html>"""
			
			
def getDataStore(resultTuples):
	dataStoreString = ""
	for tuple in resultTuples:
		dataStoreString += "<tr><td>" + str(tuple.bit_diff) + \
							"</td><td>" + str(tuple.closest_checksum) + \
							"</td><td>" + str(tuple.best_match_string) + \
							"</td><td>" + str(tuple.finish_time) + "</td></tr>"
	return """<html>
				<body>
					<center>
						<h1>Welcome, oh clever one who found the secret hidden data store.</h1>
						<table border="1" cellpadding="1" cellspacing="1">
						<tr>
							<td><b>Bit Difference</b></td>
							<td><b>Closest Checksum</b></td>
							<td><b>Best Match String</b></td>
							<td><b>Time</td></b>
						</tr>""" + dataStoreString + """</table>
					</center>
				</body>
			</html>"""
		